"""author: songzhiqiang
   data: 2021/11/12
   project: 2021-10-28-弹珠游戏
"""
import string


def passwd_length(str):
    if len(str) < 8:
        return 0
    else:
        return 1


def passwd_compose(str):
    up = 0
    low = 0
    number = 0
    symbol = 0
    for i in str:
        if i.isdigit():
            number = 1
        elif i.isupper():
            up = 1
        elif i.islower():
            low = 1
        else:
            symbol = 1
    sum = up + low + number + symbol
    if sum >= 3:
        return 1
    else:
        return 0


def passwd_len(str):
    for i in range(len(str)):
        if str.count(str[i:i + 3]) >= 2:
            return 0
        else:
            return 1


lst = []
while 1:
    passwd = input("请输入你的密码")
    # print(passwd_len(passwd))
    # print(passwd_compose(passwd))
    # print(passwd_length(passwd))
    add = 0
    add = passwd_len(passwd) + passwd_compose(passwd) + passwd_length(passwd)

    if passwd_len(passwd) and passwd_length(passwd) and passwd_compose(passwd):
        print(f"密码注册成功")
        lst.append("Very nice")
    else:
        if passwd_len(passwd) == 0:
            lst.append("有长度超过或等于3的子串重复")
        if passwd_compose(passwd) == 0:
            lst.append("大、小写字母.数字.其它符号少于三个")
        if passwd_length(passwd) == 0:
            lst.append("密码长度小于八位")
    print(f"密码评分为{2 + add},{lst}")
